package agents;

import behaviours.curator.ListenForTourItemQuestions;
import behaviours.curator.RegisterService;
import jade.core.AID;
import jade.core.Agent;
import jade.domain.DFService;
import jade.domain.FIPAAgentManagement.DFAgentDescription;
import jade.domain.FIPAAgentManagement.ServiceDescription;
import jade.domain.FIPAException;

public class CuratorAgent extends Agent {
    protected void setup(){		
            this.addBehaviour(new RegisterService(this));
            this.addBehaviour(new ListenForTourItemQuestions(this, getInventorAID()));
    }
    
    private AID getInventorAID(){
        DFAgentDescription dfd = new DFAgentDescription();
        ServiceDescription sd = new ServiceDescription();
        sd.setType("get inventory information");
        try {
            DFAgentDescription[] dfds = DFService.search(this, dfd);
            if (dfds.length > 0) {
                return dfds[0].getName();
            }
        } catch (FIPAException e) {
                e.printStackTrace();
        }
        
        return null;
    }
}
